package io.renren.modules.utypetwo.controller;

import java.util.Arrays;
import java.util.List;
import java.util.Map;

import io.renren.modules.welderunnormal.entity.WelderunnormalEntity;
import org.apache.shiro.authz.annotation.RequiresPermissions;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import io.renren.modules.utypetwo.entity.Utype2TableEntity;
import io.renren.modules.utypetwo.service.Utype2TableService;
import io.renren.common.utils.PageUtils;
import io.renren.common.utils.R;



/**
 * 
 *
 * @author chenshun
 * @email sunlightcs@gmail.com
 * @date 2023-09-12 14:46:12
 */
@RestController
@RequestMapping("utypetwo/utype2table")
public class Utype2TableController {
    @Autowired
    private Utype2TableService utype2TableService;

    /**
     * 列表
     */
    @RequestMapping("/list")
    public R list(@RequestParam Map<String, Object> params){
        PageUtils page = utype2TableService.listPallate(params);

        return R.ok().put("page", page);
    }

    @GetMapping("getPallate")
    public List<Utype2TableEntity> getPallate(@RequestParam(value = "key",required = false) String pname){
        return utype2TableService.getPallate(pname);
    }


    /**
     * 信息
     */
    @RequestMapping("/info/{uuid}")
    @RequiresPermissions("utypetwo:utype2table:info")
    public R info(@PathVariable("uuid") String uuid){
		Utype2TableEntity utype2Table = utype2TableService.getById(uuid);

        return R.ok().put("utype2Table", utype2Table);
    }

    /**
     * 保存
     */
    @RequestMapping("/save")
    @RequiresPermissions("utypetwo:utype2table:save")
    public R save(@RequestBody Utype2TableEntity utype2Table){
		utype2TableService.save(utype2Table);

        return R.ok();
    }

    /**
     * 修改
     */
    @RequestMapping("/update")
    @RequiresPermissions("utypetwo:utype2table:update")
    public R update(@RequestBody Utype2TableEntity utype2Table){
		utype2TableService.updateById(utype2Table);

        return R.ok();
    }

    /**
     * 删除
     */
    @RequestMapping("/delete")
    @RequiresPermissions("utypetwo:utype2table:delete")
    public R delete(@RequestBody String[] uuids){
		utype2TableService.removeByIds(Arrays.asList(uuids));

        return R.ok();
    }

}
